<html>
<head>
 
</head>
<body style="text-align=center;font-size:32px;">
<table align="center">
<tr><td><div id="problemNum" style='background-color:#999999;width:800;text-align:center;font-size:32px;'></div></td></tr>
<tr><td><div id="problemContent" style='word-wrap:break-word;background-color:#bbbbbb;width:800;text-align:left;font-size:Npx;'></div></td></tr>
<tr><td><div id="sum" style='word-wrap:break-word; color:#ffff22;font-size:48;background-color:#8855ff;width:800;text-align:center;'></div></td></tr>
<tr><td><div id="copyleft" style='word-wrap:break-word; color:#ffff22;font-size:18;background-color:#666666;width:800;text-align:right;'></div></td></tr>
<script language="javascript">
    //---------------------------------//
    // Project Euler 
    //
    // Author:thrombin
    //   Date:2015-12-13
    //---------------------------------//  
var p_order=16;//Problem Order
 
var problem='215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.<br/>\
What is the sum of the digits of the number 21000?';
 
 
//solve the problem
//==============编程思路简介================
//  采用数组存储每次的结果
//=====================================
var N=1001;
var result=[1];//2的N次方用一个数组表示
var prod=0;
for(var i=1;i<N;i++){
    jin_wei=0;
    for(var j=0;j<result.length;j++){
        prod=(result[j])*2+jin_wei;     
        result[j]=prod%10;
        jin_wei=parseInt(prod/10);
    }
    if(!(jin_wei==0))result.push(jin_wei);
 
}
 
//求和
var sum=0;
for(var i=0;i<result.length;i++){
    sum+=result[i];
}
 
//update browser
document.getElementById("problemNum").innerHTML="Project Euler-Problem "+p_order;
document.getElementById("problemContent").innerHTML=problem;
document.getElementById("sum").innerHTML="Answer:"+sum;
document.getElementById("copyleft").innerHTML="CopyLeft@Thrombin 2015";
</script>
</body>
</html>